package com.atguigu.tingshu.dispatch.job.job;

import com.atguigu.tingshu.search.client.SearchFeignClient;
import com.atguigu.tingshu.user.client.UserFeignClient;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Slf4j
@Component
@SuppressWarnings("all")
public class DispatchHandler {

    @Autowired
    private SearchFeignClient searchFeignClient;
    @Autowired
    private UserFeignClient userFeignClient;

    /**
     * 定时刷新热点商品排行榜
     */
    @XxlJob("updateLatelyAlbumRanking")
    public void updateLatelyAlbumRanking(){
        log.info("开始更新不同分类不同排行TOP20数据...");
        searchFeignClient.updateLatelyAlbumRanking();
    }

    /**
     * 定时更新VIP状态：处理过期会员
     */
    @XxlJob("updateUserVipStatus")
    public void updateUserVipStatus(){
        log.info("开始处理过期会员...");
        userFeignClient.updateUserVipStatus();
    }


}